<?php
namespace Home\Controller;
use Think\Controller;
class LoginController extends Controller {
    public function index(){
        $this->display();
    }
      public function log(){
             $user=D("Admin");
             $_key["admin_id"]=$_POST["username"];
             $_key["admin_password"]=$_POST["password"];
             $date=$user->where($_key)->find();
            if($date){
                session("Admin_id", $date[admin_id]);
                session("Admin_name", $date[admin_name]);
                $this->success("欢迎回来",URL);
            }
            else
                $this->error ("账号或者密码错误", URL."admin.php/login");
    }
     public function logout(){
                session("Admin_id",null);
                session("Admin_level", null);
                session("Admin_name", null);
                $this->success("退出成功",URL);
     }
}